package com.ysd.lis.controller.sys;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.dto.InterfaceDto;
import com.ysd.lis.request.InterfaceDictParam;
import com.ysd.lis.request.SysParamParam;
import com.ysd.lis.service.SysInterfaceMethValueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author prs
 * @since 2024-2-21
 */
@Api(tags = "系统参数值")
@RestController
@RequestMapping("/api/sys/sysInterfaceMethValue")
public class SysInterfaceMethValueController extends BaseController {

    @Autowired
    SysInterfaceMethValueService sysInterfaceMethValueService;

    @ApiOperation("根据paramCode查询出参数及参数下的分组和字段属性")
    @GetMapping("/findSysParamInfoByCode")
    public Result findSysParamInfoByCode(SysParamParam param) throws JsonProcessingException {
        return sysInterfaceMethValueService.findSysParamInfoByCode(param);
    }

    @ApiOperation("保存扩展属性值")
    @PostMapping("/saveInterfaceMethValueList")
    public Result saveInterfaceMethValueList(@RequestBody InterfaceDto dto) throws JsonProcessingException {
        return sysInterfaceMethValueService.saveInterfaceMethValueList(dto);
    }

    @ApiOperation("根据paramCode查询出参数及参数下的分组和字段属性值")
    @GetMapping("/findInterfaceMethValueList")
    public Result findInterfaceMethValueList(InterfaceDictParam param) throws JsonProcessingException {
        return sysInterfaceMethValueService.findInterfaceMethValueList(param);
    }

    @ApiOperation("根据paramCode查询出参数及参数下的分组和字段属性以及数据值")
    @GetMapping("/findSysParamFieldAndValueByCode")
    public Result findSysParamFieldAndValueByCode(SysParamParam param) throws JsonProcessingException {
        return sysInterfaceMethValueService.findSysParamFieldAndValueByCode(param);
    }

    @ApiOperation("查询出改列表下所有的场景设置")
    @GetMapping("/findInterfaceMethValueListByModuleIdAndSystemId")
    public Result findInterfaceMethValueListByModuleIdAndSystemId(InterfaceDictParam param) {
        return sysInterfaceMethValueService.findInterfaceMethValueListByModuleIdAndSystemId(param);
    }

}
